﻿#ifndef ModelMeshPart_h
#define ModelMeshPart_h

// CSharp includes.
#include <Typedef.h>
#include <Defines.h>

#include "Effect/Effect.h"
#include "Vertices/IndexBuffer.h"
#include "Vertices/VertexBuffer.h"
#include "ModelMesh.h"

namespace Riccsson
{
	namespace Xna
	{
		namespace Framework
		{
			namespace Graphics
			{
				class ModelMeshPart sealed
				{
					// Summary:
					//     Gets or sets the material Effect for this mesh part. Reference page contains
					//     code sample.
					private: GC_PTR<Effect> _effect;

					public: PROP3_GET(GC_PTR<Effect>, Effect)
					{
						return _effect;
					}
					public: PROP3_SET(GC_PTR<Effect>, Effect)
					{
						if (value == _effect)
						{
							return;
						}
						_effect = value;
						parent->Effects.Add (value);
					}

					//
					// Summary:
					//     Gets the index buffer for this mesh part.
					public: GC_PTR<IndexBuffer> IndexBuffer;
					//
					// Summary:
					//     Gets the number of vertices used during a draw call.
					public: int NumVertices;
					//
					// Summary:
					//     Gets the number of primitives to render.
					public: int PrimitiveCount;
					//
					// Summary:
					//     Gets the location in the index array at which to start reading vertices.
					public: int StartIndex;
					//
					// Summary:
					//     Gets or sets an object identifying this model mesh part.
					public: GC_PTR<Riccsson::System::object> Tag;
					//
					// Summary:
					//     Gets the vertex buffer for this mesh part.
					public: GC_PTR<VertexBuffer> VertexBuffer;
					//
					// Summary:
					//     Gets the offset (in vertices) from the top of vertex buffer.
					public: int VertexOffset;


					public: /*internal*/ int VertexBufferIndex;
					public: /*internal*/ int IndexBufferIndex;
					public: /*internal*/ int EffectIndex;
					public: /*internal*/ GC_PTR<ModelMesh> parent;
				};
			}
		}
	}
}

#endif